<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                version="1.0">  
  <xsl:output method="xml" indent="yes"/>
  <xsl:template match="document">
    <document name="{@name}">
      <xsl:apply-templates select="chapter"/>
    </document>
  </xsl:template>
  <xsl:template match="chapter">
    <chapter name="{@name}">
      <xsl:apply-templates select="chapter"/>
    </chapter>
  </xsl:template>
</xsl:stylesheet>
